from today import Event, Guest


class TestEvent:

    def test_add_event(self):
        self.event = Event()
        data = {
            'eid': 122222,
            'name': 'requests发布会92',
            'limit': 3,
            'status': 1,
            'address': 'A4教室',
            'start_time': '2023-7-31 12:30:30'
        }
        result = self.event.add_event(data)
        print(result)
        status = result.get('status_code')
        assert status == 200
        print(status)
        back_code = result.get('body').get('status')
        assert back_code == 10200
        print(back_code)

    def test_get_event(self):
        self.event = Event()
        result = self.event.get_event({"eid": 7722})
        status = result.get('status_code')
        assert status == 200
        print(status)
        back_code = result.get('body').get('status')
        assert back_code == 10200
        print(back_code)

    def test_add_guest(self):
        self.guest = Guest()
        payload = {
            "eid": 233333,
            "realname": "蔡徐坤",
            "phone": "12345678911",
            "email": "1@qq.com"
        }
        result = self.guest.add_guest(payload)
        status = result.get('status_code')
        assert status == 200
        print(status)
        back_code = result.get('body').get('status')
        assert back_code == 10200
        print(back_code)

    def test_get_guest(self):
        self.guest = Guest()
        result = self.guest.get_guest({"eid": 233333, "phone": "12345678911"})
        status = result.get('status_code')
        assert status == 200
        print(status)
        back_code = result.get('body').get('status')
        assert back_code == 10200
        print(back_code)

    def test_sign_guest(self):
        self.guest = Guest()
        result = self.guest.sign_guest({"eid": 233333, "phone": "12345678911"})
        status = result.get('status_code')
        assert status == 200
        print(status)
        back_code = result.get('body').get('status')
        assert back_code == 10200
        print(back_code)
